package cn.gjxblog.core.captcha.sms;

import cn.gjxblog.core.captcha.BaseCaptcha;

import java.awt.image.BufferedImage;
import java.time.LocalDateTime;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/1/17 10:24
 */
public class SmsCapthcha extends BaseCaptcha {
    private String code;
    private LocalDateTime expireTime;


    private boolean expried;


    public SmsCapthcha(String code, int expireTime) {
        this.code = code;
        //获取当前时间 并叠加过期时间 LocalDateTime jdk1.8 新的日期类型
        this.expireTime =LocalDateTime.now().plusSeconds(expireTime);
    }

    public boolean isExpried() {
        return LocalDateTime.now().isAfter(expireTime);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }

    public void setExpried(boolean expried) {
        this.expried = expried;
    }


}
